//
// Created by rebeater on 2020/11/11.
//

#ifndef LOOSELY_COUPLE_EMBEDED_WGS84_H
#define LOOSELY_COUPLE_EMBEDED_WGS84_H
#include "nav_struct.h"
typedef struct  {
    double dn;
    double de;
    double dd;
    double d;
}deltaPos;
class WGS84 {
public:
    const double omega_e = 7.2921151467e-5; /*地球自转角速度 */
    const double e2 = 0.00669437999013;/*偏心率*/
    const double g0 = 9.7803267715;/*赤道重力加速度*/
    const double GM = 3.986005e14;
    const double mg = 1e-3 * g0;
    const double ug = 1e-6 * g0;
    const double r = 6378137.0;/*长轴*/
    const double f = (1.0 / 298.257223563);
    double g = g0;

    double RM(double lat) const;
    void update_g(double lat,double h) ;

    double RN(double lat) const;

    double dN(double lat1, double lat2) const;

    double dE(double lat, double lon1, double lon2) const;

    deltaPos distance(double lat1, double lon1, double lat2, double lon2) const;
    deltaPos  distance(double lat1, double lon1, double lat2, double lon2,double h1,double h2)const;
    deltaPos distance(GnssData pos1, GnssData pos2) const;

    deltaPos distance(NavPva nav1, NavPva nav2) const;
};
extern WGS84 wgs84;
#endif //LOOSELY_COUPLE_EMBEDED_WGS84_H
